#pragma once

#include "LAMEBitmap.h"

class LAMEFont
{
	LAMEBitmap *bmp;

	short sizeOfChar[256];
	short charX[256];
	int h;
public:
	LAMEFont();
	void load(LAMEBitmap &b);
	void drawText(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color = 0, void (*blitter)(short16*,short16*,int,int)=color_blit,int xmax=0xffff);
	void drawTextCenter(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color)
	{
		drawText(b,text,x-textSize(text)/2,y-h/2,color);
	}
	void drawTextShadow(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color=0xffff, short16 shadowColor=0)
	{
		drawText(b,text,x+1,y+1,shadowColor);
		drawText(b,text,x,y,color);
	}
	void drawTextContrast(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color=0xffff, short16 shadowColor=0)
	{
		drawText(b,text,x,y+1,shadowColor);
		drawText(b,text,x-1,y,shadowColor);
		drawText(b,text,x,y-1,shadowColor);
		drawText(b,text,x+1,y,shadowColor);
		drawText(b,text,x,y,color);
	}
	void drawTextShadowCenter(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color=0xffff, short16 shadowColor=0)
	{
		drawTextShadow(b,text,x-textSize(text)/2,y-h/2,color, shadowColor);
	}
	void drawTextContrastCenter(LAMEBitmap &b, const TCHAR *text, int x, int y, short16 color=0xffff, short16 shadowColor=0)
	{
		drawTextContrast(b,text,x-textSize(text)/2,y-h/2,color, shadowColor);
	}

	int textSize(const TCHAR *text);
	int textHeight(){return h;}
};

extern LAMEFont fonts[3];